<script setup>
import { onBeforeUnmount ,ref} from 'vue';
import emitter from '../utils/bus';
let message = ref('')

emitter.on('sendDataTo1',{msg:"来自组件2的消息"})

</script>

<template>
    <div>
        <h2>组件2</h2>
        <el-button @click="click">给组件1传递信息</el-button>
    </div>
</template>